﻿using stirling_chillers.ViewModels;
using stirling_chillers.Views;
using Prism.Ioc;
using System.Windows;
using System.Configuration;
using System.Windows.Navigation;
using stirling_chillers.Data;
using stirling_chillers.Services;
using System.Configuration;

namespace stirling_chillers
{
    /// <summary>
    /// Interaction logic for App.xaml
    /// </summary>
    public partial class App : PrismApplication
    {
        /// <summary>
        /// 设置主程序类
        /// </summary>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        protected override Window CreateShell()
        {
            return Container.Resolve<LoginView>();
        }

        /// <summary>
        /// 注入服务
        /// </summary>
        /// <param name="containerRegistry"></param>
        protected override void RegisterTypes(IContainerRegistry containerRegistry)
        {

            // 注册数据库配置和服务
            var connectionString = ConfigurationManager.AppSettings["MySqlConnection"];
            containerRegistry.RegisterInstance(new MySqlConfig { ConnectionString = connectionString });

            containerRegistry.RegisterSingleton<IAuthService, AuthService>();
            containerRegistry.RegisterSingleton<IUserRepository, UserRepository>();

            // 注册视图
            //登陆页面---瞬态
            

        }
    }

}
